package jp.sourceforge.akjrcp.ffmpeg;

import java.io.File;
import java.io.IOException;

import jp.sourceforge.akjrcp.util.ProcessMonitor;
import jp.sourceforge.akjrcp.util.ProcessPrinter;

public class FFMpegFileInfomation {
	private double videoRate;
	private byte fileSize;
	private String fileName;
	private String fileDirectory;
	private String videoCodec;
	private String audioCodec[]=new String[32];
	private int audioChannel[]=new int[32];
	private int audioRate[]=new int[32];
	private int audioBitrate[]=new int[32];
	private int videoWidth;
	private int videoHeight;
	private int videoBitrate;
	private long playTime;
	private boolean haveAudio;
	private boolean haveVideo;
	public static final String FLV1="flv";
	public static final String FLV4="vp6f";
	public static final String MP3="mp3";
	public static final String MP3_0x0055="0x0055";
	private String duration;
	
	private String text;
	
	public int countAudioTracks(){
		int r=0;
		for (int i = 0; i < audioRate.length; i++) {
			if(audioRate[i]!=0){
				r=i+1;
			}else{
				break;
			}
		}
		return r;
	}
	//todo add
	//bitrate
	//start
	public String toString(){
		StringBuffer result=new StringBuffer();
		result.append("video(");
		result.append("codec="+videoCodec+",");
		result.append("width="+videoWidth+",");
		result.append("height="+videoHeight+",");
		result.append("frameRate="+videoRate+",");
		result.append(")\n");
		result.append("Audio(");
		result.append("codec="+audioCodec+",");
		result.append("rate="+audioRate+",");
		result.append("channel="+audioChannel+",");
		result.append("bitrate="+audioBitrate+",");
		result.append(")\n");
		return result.toString();
	}
	
	public int getAudioBitrate() {
		return audioBitrate[0];
	}
	public void setAudioBitrate(int audioBitrate) {
		this.audioBitrate[0] = audioBitrate;
	}
	public int getAudioChannel() {
		return audioChannel[0];
	}
	public void setAudioChannel(int audioChannel) {
		this.audioChannel[0] = audioChannel;
	}
	public String getAudioCodec() {
		return audioCodec[0];
	}
	public void setAudioCodec(String audioCodec) {
		this.audioCodec[0] = audioCodec;
	}
	public int getAudioRate() {
		return audioRate[0];
	}
	public void setAudioRate(int audioRate) {
		this.audioRate[0] = audioRate;
	}
	
	public int getAudioBitrate(int index) {
		return audioBitrate[index];
	}
	public void setAudioBitrate(int audioBitrate,int index) {
		this.audioBitrate[index] = audioBitrate;
	}
	public int getAudioChannel(int index) {
		return audioChannel[index];
	}
	public void setAudioChannel(int audioChannel,int index) {
		this.audioChannel[index] = audioChannel;
	}
	public String getAudioCodec(int index) {
		return audioCodec[index];
	}
	public void setAudioCodec(String audioCodec,int index) {
		this.audioCodec[index] = audioCodec;
	}
	public int getAudioRate(int index) {
		return audioRate[index];
	}
	public void setAudioRate(int audioRate,int index) {
		this.audioRate[index] = audioRate;
	}
	
	public String getFileDirectory() {
		return fileDirectory;
	}
	public void setFileDirectory(String fileDirectory) {
		this.fileDirectory = fileDirectory;
	}
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	public byte getFileSize() {
		return fileSize;
	}
	public void setFileSize(byte fileSize) {
		this.fileSize = fileSize;
	}
	public long getPlayTime() {
		return playTime;
	}
	public void setPlayTime(long playTime) {
		this.playTime = playTime;
	}
	public int getVideoBitrate() {
		return videoBitrate;
	}
	public void setVideoBitrate(int videoBitrate) {
		this.videoBitrate = videoBitrate;
	}
	public String getVideoCodec() {
		return videoCodec;
	}
	public void setVideoCodec(String videoCodec) {
		this.videoCodec = videoCodec;
	}
	public int getVideoHeight() {
		return videoHeight;
	}
	public void setVideoHeight(int videoHeight) {
		this.videoHeight = videoHeight;
	}
	public double getVideoRate() {
		return videoRate;
	}
	public void setVideoRate(double videoRate) {
		this.videoRate = videoRate;
	}
	public int getVideoWidth() {
		return videoWidth;
	}
	public void setVideoWidth(int videoWidth) {
		this.videoWidth = videoWidth;
	}
	public boolean isHaveAudio() {
		return haveAudio;
	}
	public void setHaveAudio(boolean haveAudio) {
		this.haveAudio = haveAudio;
	}
	public boolean isHaveVideo() {
		return haveVideo;
	}
	public void setHaveVideo(boolean haveVideo) {
		this.haveVideo = haveVideo;
	}
	public String getDuration() {
		return duration;
	}
	public void setDuration(String duration) {
		this.duration = duration;
	}
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
}
